package eight.test_8_1;

import java.util.Arrays;
import java.util.Scanner;

public class TestMain3 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int v = scanner.nextInt();
        int n = scanner.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = scanner.nextInt();
        }
        Arrays.sort(arr);
        for (int i = 0; i < n; i++) {
            int tmp = v - i;
            if(tmp >= 0) {
                v -= i;
            }
        }
        System.out.println(v);
    }
}
